<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>教师入驻信息</title>
    <link rel="stylesheet" href="css/register.css"/>
</head>
<body>
<div class="wrapper">
    <div class="form-panel">
        <div class="title">基本信息</div>
        <div class="form">
            <form id="formId">
                <div class="item">
                    <label>姓名：</label>
                    <input name="teacherName" placeholder="请填写您的姓名"/>
                </div>
                <div class="item">
                    <label>电话：</label>
                    <input name="phoneNumber" placeholder="请填写您的联系电话"/>
                </div>
                <div class="item">
                    <label>学校：</label>
                    <input name="schoolName" placeholder="请填写您的学校名称"/>
                </div>
                <div class="item">
                    <label>年级：</label>
                    <input name="gradeCode" placeholder="请填写您当前的任教年级"/>
                </div>
                <div class="item">
                    <label>班级：</label>
                    <input name="classCode" placeholder="请填写您当前的任教班级"/>
                </div>
                <div class="item">
                    <label>邮箱：</label>
                    <input name="email" placeholder="请填写您的邮箱"/>
                </div>
                <div class="item">
                    <label>教龄：</label>
                    <input name="teacherAge" placeholder="请填写您的教龄"/>
                </div>
                <button type="button" class="submit">确认提交</button>
            </form>
        </div>
    </div>
</div>
</body>
<script src="js/jquery.min.js?v=2.1.4"></script>
<script type="text/javascript" src="js/hotcss.js"></script>


<script>

  $(function () {

    /**
     * 获取参数
     */
    function getParam(paramName) {
      paramValue = "";
      isFound = false;
      if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
        arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&");
        i = 0;
        while (i < arrSource.length && !isFound) {
          if (arrSource[i].indexOf("=") > 0) {
            if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
              paramValue = arrSource[i].split("=")[1];
              isFound = true;
            }
          }
          i++;
        }
      }
      return paramValue;
    }

    /*
     * 点击提交
     */
    $('.submit').click(function () {
      var postData = $("#formId").serialize();
      var tmpDic = {};
      for (var i in postData.split("&")) {
        var row = postData.split("&")[i];
        if (!decodeURIComponent(row.split("=")[1])) {
          alert('您有字段没有填写~');
          return false;
        }
        tmpDic[row.split("=")[0]] = decodeURIComponent(row.split("=")[1]);
      }
      $.ajax({
        url: "/tkTeacherRecord/insert",
        type: 'post',
        dataType: 'json',
        data: tmpDic,
        success: function (json) {
          if (!json.success) {
            layer.msg(json.errorMessage + "（请联系我们）");
            return;
          }
          alert('申请成功，请耐心等待');
        }
      });
    });
  })
</script>
</html>
